package com.jiaoyou.baojian.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.jiaoyou.baojian.MainActivity;
import com.jiaoyou.baojian.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class LoginRegActivity extends BaseActivity {

    @BindView(R.id.login)
    Button login;
    @BindView(R.id.reg)
    Button reg;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
    }

    @Override
    public int getContentView() {
        return R.layout.activity_login_reg;
    }

    @OnClick({R.id.login, R.id.reg})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.login:
                startActivity(LoginActivity.class);
                break;
            case R.id.reg:
                startActivity(RegisterActivity.class);
                break;
        }
    }

    @Override
    public void onBackPressed() {
        Intent intent = new Intent(LoginRegActivity.this, MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
        super.onBackPressed();
    }
}
